import {ScrollView, View, Text, Image} from '@tarojs/components';
import React, {Component} from 'react';
import Taro, {getCurrentInstance} from '@tarojs/taro';
import {connect} from 'react-redux';
import './index.less';
import * as T from './types';
import actions from './actions';
import {store2Props} from './selectors';

actions().actions.loadReducer();
// @ts-ignore
@connect<Partial<T.IProps>, any>(store2Props, actions)
export default class Index extends Component<Partial<T.IProps>, any> {
  constructor(props) {
    super(props);
    this.state = {};
  }

  componentDidMount() {
    let {
      actions: {action},
    } = this.props;
    let {orderId} = getCurrentInstance().router.params;
    action.commonChange('main.orderId', orderId);
    action.getWhaleOrderId(orderId);
  }

  componentDidShow() {}

  componentWillUnmount() {
    this.props.actions.clean();
  }

  render() {
    let {
      main: {detail},
      actions: {action},
    } = this.props;
    return (
      <View className="packageDLogisticsInformation">
        <View className="main">
          <View className="listRow">
            <View className="text">快递公司</View>
            <View className="text">{detail?.logisticsName}</View>
          </View>
          <View className="listRow">
            <View className="text">快递单号</View>
            <View className="text">{detail?.expressNo}</View>
          </View>
          <View className="listRow">
            <View className="text">快递人员</View>
            <View className="text">{detail?.expressName}</View>
          </View>
          <View className="listRow">
            <View className="text">联系号码</View>
            <View className="text">{detail?.expressTel}</View>
          </View>
          <View className="listRow">
            <View className="text">重量</View>
            <View className="text">{detail?.expressAmount ? detail?.expressAmount + 'kg' : ''}</View>
          </View>
        </View>
      </View>
    );
  }
}
